import java.util.Scanner;

public class Assignment1 {

// Selection Sort 
	
//							Input array is 98, 2, 3, 1, 0, 0, 0, 3, 98, 98, 2, 2, 2, 0, 0, 0, 2, 
//							Array in ascending order is 0, 0, 0, 0, 0, 0, 1, 2, 2, 2, 2, 2, 3, 3, 98, 98, 98, 
	
	
	public static void main(String[] args) {
		
		System.out.println("How many numbers to sort ");
		Scanner s = new Scanner(System.in);
		int numofinputs = s.nextInt();
		CalcAPI apiobj = new CalcAPI();
		int iparray[] = new int[numofinputs];
		for (int i=0;i<numofinputs;i++) {
			System.out.println("Please enter integer input #" + (i+1));
			iparray[i] = apiobj.getIntInput();			
		}
		System.out.print("Input array is ");
		for (int i=0;i<numofinputs;i++) {
			System.out.print(iparray[i]);	
			System.out.print(", ");
		}		
		for(int i=0;i<numofinputs;i++) {
			int temp = i;
			for(int j=i+1;j<numofinputs;j++) {
				if(iparray[temp] > iparray[j])
					temp = j;				
			}
			int tempval = iparray[i];
			iparray[i] = iparray[temp];
			iparray[temp] = tempval;			
		}
		System.out.println();
		System.out.print("Array in ascending order is ");
		for (int i=0;i<numofinputs;i++) {
			System.out.print(iparray[i]);	
			System.out.print(", ");
		}
	}

}
